import Service from '@/common/service/service';
import ResponseModel from '@/common/model/response.model';
import RequestModel from "@/common/model/request.model";
import TreeModel from "@/components-com/person-selection/model/tree.model";
import PersonRequestModel from "@/components-com/person-selection/model/person-request.model";
import PersonModel from "@/components-com/person-selection/model/person.model";
import RoleModel from "@/components-com/person-selection/model/role.model";

/**
 * 查询组织机构人员服务类
 */
export default class PersonSelectionService {

	/**
	 * 懒加载树节点接口
	 */
	public static findOrganization(data:number): Promise<ResponseModel<TreeModel[]>> {
		return Service.post('sys/organization/findOrganization',data)
	}
	/**
	 * 搜索组织机构树（返回树结构）
	 */
	public static searchOrganization(data:number|string): Promise<ResponseModel<TreeModel[]>> {
		return Service.get('sys/organization/searchOrganization',data)
	}

	/**
	 * 查询角色
	 */
	public static findAllRole(): Promise<ResponseModel<RoleModel[]>> {
		return Service.get('sys/role/findAllRole')
	}

	/**
	 * 根据条件查询用户（分页）
	 */
	public static findUserListByPage(data:RequestModel<PersonRequestModel>): Promise<ResponseModel<PersonModel[]>> {
		return Service.post('sys/chooseUserData/findUserListByPage',data)
	}
	/**
	 * 根据条件查询用户（不分页）
	 */
	public static findAllUserList(data:RequestModel<PersonRequestModel>): Promise<ResponseModel<PersonModel[]>> {
		return Service.post('sys/chooseUserData/findAllUserList',data)
	}

	/**
	 * 查询回显用户（接口地址从使用本组件的地方传入）
	 */
	public static findCheckedUserList(url:string,data:RequestModel<PersonRequestModel>): Promise<ResponseModel<PersonModel[]>> {
		return Service.post(url,data)
	}


}
